<template>
    <div>
        <h1>Http工具</h1>
        <div>常用的操作Http工具</div>

        <h3>ping-对指定地址获取ping值</h3>
        <dCode :code="conf.str" />
    </div>
</template>
<script setup lang="ts">
import { reactive } from 'vue'

const conf = reactive({
    str: `
const init = async () => {
    let urlarr = ['https://www.baidu.com', 'https://jd.com', 'https://bilibili.com']
    const res = await Promise.all(
        urlarr.map((u) =>
            HttpUtil.ping(u).then((time) => {
                return { time, u }
            })
        )
    )
    console.log(res)
}
init()
    `
})

</script>
<style lang="less" scoped></style>
